Ext.define('AM.controller.DemoController',
		{
			extend : 'AM.controller.BaseController',
			stores : [ 'DemoStore' ],
			models : [ 'DemoModel' ],
			views : [ 'AM.view.demo.List' ],
			init : function() {
				this.control({
					'demolist' : {
						render : this.viewRender
					},
					'demolist basegridlist button[action=addtest]' : {
						click : this.add
					},
					'demolist basegridlist button[action=deltest]' : {
						click : this.del
					},
					'demolist button[action=edittest]' : {
						click : this.edit
					},
					'demolist button[action=querytest]' : {
						click : this.aaa
					}
				});
				// 设置编辑框的字段值
				this.fieldItems = [ {
					xtype : 'textfield',
					name : 'name',
					fieldLabel : '姓名:'
				}, {
					xtype : 'numberfield',
					name : 'age',
					fieldLabel : '年龄:'
				} ];
				this.callParent(arguments);
			},
			viewRender : function(me) {
				console.log('DemoController viewRender');
				console.log(this);
				var queryPanel = me.items.items[0];
				queryPanel.add({
					layout : 'hbox',
					margin : '0 0 10 0 ',
					defaults : {
						labelAlign : 'right',
						labelWidth : 50,
					},
					items : [ {
						xtype : 'textfield',
						name : 'name',
						fieldLabel : '姓名:'
					} ]
				});
				var gridPanel = me.items.items[1];
				gridPanel.title = 'AAA List';
				var columns = [ Ext.create('Ext.grid.RowNumberer'), {
					header : 'name',
					dataIndex : 'name'
				}, {
					header : '年龄',
					dataIndex : 'age'
				} ];
				gridPanel.reconfigure(this.getDemoStoreStore(), columns);

				// 设置图表区
				var chartPanel = me.items.items[3];
				chartPanel.hidden = false;
				
				var chart = chartPanel.items.items[0];
				chart.axes.items[0].title = '年龄';
				chart.axes.items[0].fields[0] = 'age';
				chart.axes.items[1].title = '姓名';
				chart.axes.items[1].fields[0] = 'name';
				
				chart.series.items[0].xField = 'name';
				chart.series.items[0].yField = 'age';
				
				chart.bindStore(this.getDemoStoreStore());

			}
		});